import request from '@/content/utils/request'

// 获取全国省市区
const getAllArea = () => {
  return request({
    url: '/school/getAllArea',
    method: 'get',
    params: {},
  })
}
// 获取学段
const getEduLevels = () => {
  return request({
    url: '/school/getEduLevels',
    method: 'get',
    params: {},
  })
}
//根据学校获取地区和学段
const getAreaAndEduLevel = data => {
    return request({
        url: '/school/getAreaAndEduLevel',
        method: 'post',
        data,
    })
}

//更新用户学校
const updateSchool = data => {
    return request({
        url: '/school/updateSchool',
        method: 'post',
        data,
    })
}

// 获得学校列表
const getSchoolsByAreaId = (data) => {
  return request({
    url: '/school/getSchoolsByAreaId',
    method: 'post',
    data,
  })
}

// 获得教材出版社列表
const getAllPublisher = () => {
  return request({
    url: '/lesson/getAllPublisher',
    method: 'get',
    params: {},
  })
}

//获得教材
const getBooksByPublisherId = (data) => {
  return request({
    url: '/lesson/getBooksByPublisherId',
    method: 'post',
    data,
  })
}

const getChapterLessonByBookId = (data) => {
  return request({
    url: '/lesson/getChapterLessonByBookId',
    method: 'post',
    data,
  })
}

export default {
  getAllArea,
  getEduLevels,
  getSchoolsByAreaId,
  getAllPublisher,
  getBooksByPublisherId,
  getChapterLessonByBookId,
  updateSchool,
  getAreaAndEduLevel
}
